package org.mogoo.test;

public class Main
{
    public static void main(String[] args)
    {
        /*Parent child = new Child();
        child.cry();
        child.say();
        Grandson child2 = new Grandson()fffff;*/
        
    	Animal animal = new Dog();
        animal.eat();
        
        Dog dog = (Dog)animal;
        dog.playDead();
        
        Dog dog2 = new Dog();
        dog2.eat();
        
        pet pet = dog2;
        pet.befriendly();
        
        A a = new A();
        A b = a;
        a.changeA(5);
        a.say();
        b.say();
        
    }
}

abstract class Parent
{
    int a = 1;
    
    public abstract void say();

    public void cry()
    {
        System.out.println("class parent, method cry!");
    }
}

abstract class Middle extends Parent
{

}

class Child extends Middle
{
    static  int f ;

    public void say()
    {
        final int b;
        a = 2;
        System.out.println("class child, method say! a="+a);
    }

    public static void cry1()
    {
        f = 2;
        System.out.println("class child, method cry!");
    }
}

class Animal
{
    public void eat()
    {
        System.out.println("animal's eat()!");
    }
}

class Dog extends Animal implements pet
{
	public void eat()
    {
        System.out.println("dog's eat()!");
    }
    
    public void playDead()
    {
        System.out.println("dog's playDead()!");
    }

	@Override
	public void befriendly()
	{
		// TODO Auto-generated method stub
		System.out.println("dog's beFriendly()! Math.random()"+((int)(Math.random()*5)));
	}
}

interface pet
{
	void befriendly();
}

class A 
{
	public int a = 1;
	public void say()
	{
		System.out.println("a is "+a);
	}
	
	public static void siren()
	{
		
	}
	public void changeA(int a)
	{
		this.a = a;
	}
	
}

class B extends A
{
	private int i = 0;
	B()
	{
		super();
		i = 1;
	}
	
	public void say()
	{
	}
}

interface C
{
	void say();
}

abstract class D implements C
{
	
}
